﻿#ifndef TCPCODEC_SCRIPT_H
#define TCPCODEC_SCRIPT_H

#include <qobject.h>
#include "TcpCodecBase.h"
#include "ObjAutoInject.h"

#include <qlist.h>

#include "ScriptInstruction.h"

class TcpCodec;
//class ScriptInstruction;
class TcpCodec_Script : public QObject,public TcpCodecBase,public ObjAutoInject
{
  Q_OBJECT
public:
  enum Script{
    GetScript=0,
    SetScript,
    StartScript,
    StopScript
  };
private://dependency
  TcpCodec* tcpCodec=Q_NULLPTR;
public:
  explicit TcpCodec_Script();
  virtual ~TcpCodec_Script();
signals:
  void signal_script(QList<ScriptInstruction*> scriptList);
public:
  virtual void decode(DataPackage_TcpCodec* dataPackageInfo_User)override;
  void getScript(uint deviceId);
  void setScript(QList<ScriptInstruction*> scriptList);
  void startScript(uint deviceId);
  void stopScript(uint deviceId);
public://geter and seter
  TcpCodec* getTcpCodec()const;
  TcpCodec_Script* setTcpCodec(TcpCodec*const tcpCodec);
public:
  virtual void objectAutoInjection(QHash<QString,QObject*>* objMap)override;
};

#endif // TCPCODEC_SCRIPT_H
